package a1_4;

/**
 * 信用卡支付（Payment子类）
 */
public class Credit extends Payment {
    private String number;       // 卡号
    private String type;         // 类型（如VISA、MasterCard）
    private String expireDate;   // 过期日期（格式：YYYY-MM）

    public Credit() {}

    public Credit(double amount, String number, String type, String expireDate) {
        super(amount);
        this.number = number;
        this.type = type;
        this.expireDate = expireDate;
    }

    // 实现父类抽象方法：验证信用卡有效性（简化逻辑）
    @Override
    public boolean validatePayment() {
        return number != null && number.length() >= 16 && expireDate != null && !expireDate.isEmpty();
    }

    // Getter/Setter
    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getExpireDate() {
        return expireDate;
    }

    public void setExpireDate(String expireDate) {
        this.expireDate = expireDate;
    }
}